/*
package com.itheima.domain.annotation;

import cn.hutool.core.util.ArrayUtil;
import cn.hutool.json.JSONUtil;
import com.itheima.domain.pojo.OperateLog;
import com.itheima.mapper.OperateLogMapper;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.time.LocalDateTime;
import java.util.Arrays;

*/
/**
 * @author: Sch
 * @Date: 2025/07/18 12:16
 * @Description:
 *//*

@Aspect
@Component
public class OperationLogAspect {
    @Autowired
    private OperateLogMapper operateLogMapper;

    @Around("@annotation(com.itheima.domain.annotation.LogOperation)")
    public Object insertLogMapper(ProceedingJoinPoint pjp) throws Throwable {
        OperateLog operateLog = new OperateLog();

        //TODO 操作人ID
        operateLog.setOperateEmpId(0);
        //操作时间
        operateLog.setOperateTime(LocalDateTime.now());
        //全类名
        String className = pjp.getTarget().getClass().getName();
        operateLog.setClassName(className);
        //参数
        Object[] args = pjp.getArgs();
        String methodName = pjp.getSignature().getName();
        //执行时长
        long start = System.currentTimeMillis();
        Object result = pjp.proceed();
        long end = System.currentTimeMillis();
        operateLog.setCostTime(end - start);

        //返回值
        operateLog.setReturnValue(JSONUtil.toJsonStr(result));
        operateLogMapper.insert(operateLog);
        return result;
    }
}
*/
